package shujvjiegou.week7;

import java.util.Scanner;

/**
 * @Author JetZhang
 * @Date 2021/10/27
 */
public class New_t1 {

    private static int index;

    public static void main(String[] args) {
        int[] Count = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        s = s.replaceAll(" ", "");
        if (s.length() == 1) {
            System.out.println(s);
        } else {
            int temp;
            for (int i = 0; i < s.length(); i++) {
                temp = Integer.parseInt(s.substring(i, i + 1));
                Count[temp]++;
            }
            int t = 0;
            for (int i = 0; i < Count.length; i++) {
                if (Count[i] > t) {
                    t = Count[i];
                    index = i;
                }
            }
            if (s.length() % 2 == 0) {
                if (t > s.length() / 2) {
                    System.out.println(index);
                } else {
                    System.out.println("-1");
                }
            } else {
                if (t > (s.length() / 2) - 1) {
                    System.out.println(index);
                } else {
                    System.out.println("-1");
                }
            }

        }
    }

}
